// import * as React from 'react'
import React, { useEffect } from 'react'
import { NavigationContainer } from '@react-navigation/native'
import { createStackNavigator } from '@react-navigation/stack'
// redux
import { Provider } from 'react-redux'
import store from '~/redux/store'
// views
import HomeNavigator from '~/router/homeNavigator'
import InitScreen from '~/views/init'
import LoginScreen from '~/views/login'
import DiscussDetail from '~/views/discuss/detail'
import DiscussCreate from '~/views/discuss/create'
import ChatChat from '~/views/chat/chat'

const Stack = createStackNavigator()

function App() {
  var initRouteName = "InitScreen"

  useEffect(() => {
    // todo
  }, [])

  return (
    <Provider store={store}>
      <NavigationContainer>
        <Stack.Navigator initialRouteName={initRouteName} headerMode="none">
          <Stack.Screen name="HomeNavigator" component={HomeNavigator} />
          <Stack.Screen name="DiscussCreate" component={DiscussCreate} />
          <Stack.Screen name="DiscussDetail" component={DiscussDetail} />
          <Stack.Screen name="ChatChat" component={ChatChat} />
          <Stack.Screen name="LoginScreen" component={LoginScreen} />
          {/* 初始化页面 */}
          <Stack.Screen name="InitScreen" component={InitScreen} />
        </Stack.Navigator>
      </NavigationContainer>
    </Provider>
  )
}

export default App
